package com.example.yls.demoa;

import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ListView;

public class MainActivity extends AppCompatActivity {

    private static final int ADDNODE = 1001;
    private ListView listView;
    private Button btnAddNode;
    private MyDataBaseHelper helper;
    private SQLiteDatabase db;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        listView=findViewById(R.id.list_view);
        btnAddNode=findViewById(R.id.btn_addnode);
         helper= new MyDataBaseHelper(MainActivity.this);
         db= helper.getReadableDatabase();
        btnAddNode.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(MainActivity.this,AddActivity.class);
                startActivityForResult(intent,ADDNODE);
            }
        });
    }
}
